#ifndef INC_OUTPUT_H
#define INC_OUTPUT_H

#include <stdio.h>				// FILE Output
#include <string>				// String object
#include "BaseTypes.h"				// type definitions
#include "Color.h"				// Color class
/*********************************************/
// See note at setResolution in Output.cpp for details
#define SIZEOF_BMPHeader		14
#define SIZEOF_DIBHeader		40
/*********************************************/
// Basic Interface class for engine output
class IBaseOutput
{
private:
	IBaseOutput( const IBaseOutput& ) {};
	void operator=( const IBaseOutput& ) {};
	
public:
	
	virtual void setResolution( const uint32& width, const uint32& height ) = 0;
	virtual void setPixel( const uint32&, const uint32&, const Color& p ) = 0;
	virtual void clear() = 0;
	virtual void flush() = 0;

	IBaseOutput() {};
	virtual ~IBaseOutput(){};
};
/*********************************************/
// Example off an implemented output class ( output to a single bitmap )
class bmpOutput : public IBaseOutput
{
private:
	
	/****************************************/
	typedef struct
	{
		uint16	bfType;
		uint32	bfSize;
		uint16	bfReserved1;
		uint16	bfReserved2;
		uint32	bfOffBits;
	} BMPHeader;
	/****************************************/
	typedef struct
	{
		uint32	biSize;
		uint32	biWidth, biHeight;
		uint16	biPlanes, biBitCount;
		uint32	biCompression;
		uint32	biSizeImage;
		uint32	biXPelsPerMeter, biYPelsPerMeter;
		uint32	biClrUsed;
		uint32	biClrImportant;
	} DIBHeader;
	/****************************************/
	
	// Variables
	Color			*data;				// Color data
	BMPHeader		*bmpHead;			// bmp header
	DIBHeader		*dibHead;			// dib header
	std::string		ofile;				// Output file name
	
	// Functions
	void write( FILE *f );
	
protected:
public:
	
	void setResolution( const uint32& width, const uint32& height );
	void setPixel( const uint32& width, const uint32& height, const Color& p );
	void setOutputFile( const std::string& file );
	void clear();
	void flush();

	bmpOutput();
	~bmpOutput();
};
/*********************************************/
#endif //INC_OUTPUT_H
